package com.xauto.pioneer.appuser.activity;

import android.content.Intent;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.xauto.pioneer.appuser.MyApplication;
import com.xauto.pioneer.appuser.R;
import com.xauto.pioneer.appuser.activity.common.TakePhotoActivity;
import com.xauto.pioneer.appuser.activity.mine.balance.BankListActivity;
import com.xauto.pioneer.appuser.adapter.PaymentAdapter;
import com.xauto.pioneer.appuser.http.BaseLHttpHandler;
import com.xauto.pioneer.appuser.http.Constants;
import com.xauto.pioneer.appuser.http.LHttpLib;
import com.xauto.pioneer.appuser.interfaces.MemberCallBack;
import com.xauto.pioneer.appuser.interfaces.MemberDepositCallBack;
import com.xauto.pioneer.appuser.model.Image;
import com.xauto.pioneer.appuser.model.JSONStatus;
import com.xauto.pioneer.appuser.model.Member;
import com.xauto.pioneer.appuser.model.MemberDeposit;
import com.xauto.pioneer.appuser.model.Payment;
import com.xauto.pioneer.appuser.util.DataCheckUtil;
import com.xauto.pioneer.appuser.util.DataLoadUtil;
import com.xauto.pioneer.appuser.util.StringUtils;
import com.xauto.pioneer.appuser.util.ToastUtil;
import com.xauto.pioneer.appuser.util.ViewUtil;
import com.xauto.pioneer.appuser.view.TopBar;

import java.util.List;

import butterknife.Bind;
import butterknife.OnClick;
import de.greenrobot.event.EventBus;

import static com.xauto.pioneer.appuser.activity.common.TakePhotoActivity.DO_BIG_IMAGE;
import static com.xauto.pioneer.appuser.activity.common.TakePhotoActivity.UPLOAD_IMG;

/***
 * 租车审核流程 页面
 * @author Lemon Fri 3 Mar 10:55
 */
public class TakeCarVerifyActivity extends BaseActivity {

    @Bind(R.id.topBar) TopBar topBar;
    /****************** 身份证 view *****************/
    @Bind(R.id.layoutVerifyIdentity) View layoutVerifyIdentity;
    /** 显示-身份证图片*/
    @Bind(R.id.ivIdInfo) ImageView ivIdInfo;
    /** 按钮效果-身份证下一步*/
    @Bind(R.id.tvIdInfoNext) TextView tvIdInfoNext;
    /****************** 半身证 view *****************/
    @Bind(R.id.layoutVerifyHalfBodyIdentity) View layoutVerifyHalfBodyIdentity;
    /** 显示-半身照图片 */
    @Bind(R.id.ivHalfBodyIdInfo) ImageView ivHalfBodyIdInfo;
    /** 按钮效果-半身照下一步*/
    @Bind(R.id.tvHalfBodyIdInfoNext) TextView tvHalfBodyIdInfoNext;
    /***************** 行驶证 view ****************/
    @Bind(R.id.layoutVerifyDriver) View layoutVerifyDriver;
    /** 显示-行驶证图片*/
    @Bind(R.id.ivDriverInfo) ImageView ivDriverInfo;
    /** 按钮效果-行驶证下一步*/
    @Bind(R.id.tvDriverInfoNext) TextView tvDriverInfoNext;
    /***************** 银行认证 view ****************/
    @Bind(R.id.layoutBank) View layoutBank;
    /** 银行名称*/
    @Bind(R.id.TakeCar_etAccountWithDrawBankType) TextView TakeCar_etAccountWithDrawBankType;
    /** 金额*/
    @Bind(R.id.TakeCar_etDepositWithDrawBankNum)
    EditText TakeCar_etDepositWithDrawBankNum;
    /** 身份证号*/
    @Bind(R.id.TakeCar_etDepositWithDrawIdNumber)
    EditText TakeCar_etDepositWithDrawIdNumber;
    /** 姓名*/
    @Bind(R.id.TakeCar_etDepositWithDrawBankName)
    EditText TakeCar_etDepositWithDrawBankName;
    /** 按钮效果-银行认证下一步*/
    @Bind(R.id.bank_next) TextView bank_next;
    //ID
    String BankbankId = "";
/****************** 状态信息 view *****************/
    /** 审核中界面*/
    @Bind(R.id.layoutPromptStatus) View layoutPromptStatus;
    /** 审核成功界面*/
    @Bind(R.id.layoutCheckSuccess) View layoutCheckSuccess;
    /** 显示-审核状态图*/
    @Bind(R.id.ivPromptResult) ImageView ivPromptResult;
    /** 显示-审核状态提示文字*/
    @Bind(R.id.tvPromptSuccess) TextView tvPromptSuccess;
    /****************** 押金缴纳未支付 view *****************/
    @Bind(R.id.layoutDepositPayment) View layoutDepositPayment;
    /** 押金缴纳金额*/
    @Bind(R.id.tvDepositPaymentAmount) TextView tvDepositPaymentAmount;
    /** 押金说明*/
    @Bind(R.id.tvDepositPaymentTip) TextView tvDepositPaymentTip;
    /** 押金支付方式列表*/
    @Bind(R.id.listPayment) ListView listPayment;
    /** 支付方式适配器*/
    private PaymentAdapter paymentAdapter;
    /****************** 押金缴纳已支付状态显示 view *****************/
    @Bind(R.id.layoutDepositPaymentStatus) View layoutDepositPaymentStatus;
    /** 押金缴纳成功图标显示*/
    @Bind(R.id.ivDepositPaymentResult) ImageView ivDepositPaymentResult;
    /** 押金缴纳支付成功提示*/
    @Bind(R.id.tvDepositPayedTip) TextView tvDepositPayedTip;

    /***********************************************************/
    /** 状态显示-验证流程第一步*/
    @Bind(R.id.ivVerifyStatus1) ImageView ivVerifyStatus1;
    /** 验证流程中间分割线1*/
    @Bind(R.id.tvVerifyDriver1) TextView tvVerifyDriver1;
    /** 状态显示-验证流程第二步*/
    @Bind(R.id.ivVerifyStatus2) ImageView ivVerifyStatus2;
    /** 验证流程中间分割线2*/
    @Bind(R.id.tvVerifyDriver2) TextView tvVerifyDriver2;
    /** 状态显示-验证流程第三步*/
    @Bind(R.id.ivVerifyStatus3) ImageView ivVerifyStatus3;
    /** 验证流程中间分割线3*/
    @Bind(R.id.tvVerifyDriver3) TextView tvVerifyDriver3;
    //------------新增-----------------------------------
    /** 状态显示-验证流程第四步*/
    @Bind(R.id.ivVerifyStatus4) ImageView ivVerifyStatus4;
    /** 验证流程中间分割线4*/
    @Bind(R.id.tvVerifyDriver4) TextView tvVerifyDriver4;
    //---------------------------------------------------
    /** 状态显示-验证流程第四步*/
    @Bind(R.id.ivVerifyStatus5) ImageView ivVerifyStatus5;
    /** 验证流程中间分割线4*/
    @Bind(R.id.tvVerifyDriver5) TextView tvVerifyDriver5;
    /** 状态显示-验证流程第五步*/
    @Bind(R.id.ivVerifyStatus6) ImageView ivVerifyStatus6;
    /** 当前步骤*/
    private int currentStep;
    /** 当前步骤所属状态 currentStatus:1-已认证/0-未认证/2-认证中*/
    private int currentStatus;
    /** 选择本地图片路径*/
    private String currentImgLocalPath = "";
    private String currentImgUploadType;
    /** 当前选择的支付方式*/
    private String paymentCode = Constants.PAY_TYPE_ALIPAY;
    /** 身份证上传路径*/
    private String identificationUploadPath = "";

    @Override
    protected int getContentView() {
        return R.layout.ac_take_car_verify;
    }

    @Override
    protected void initView() {
        //注册EventBus
		EventBus.getDefault().register(this);
        tvIdInfoNext.setClickable(false);
        tvHalfBodyIdInfoNext.setClickable(false);
        topBar.showView(TopBar.LEFT_IMAGE_BTN, TopBar.TITLE);
        topBar.setImage(TopBar.LEFT_IMAGE_BTN, R.mipmap.ic_common_left);
        topBar.setLeftOnClick(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });

        listPayment.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if(!paymentAdapter.getDataList().get(position).isChoose) {
                    for (int i = 0; i < paymentAdapter.getDataList().size(); i++) {
                        paymentAdapter.getDataList().get(i).isChoose = false;
                    }
                    paymentAdapter.getDataList().get(position).isChoose = true;
                    paymentAdapter.notifyDataSetChanged();
                    paymentCode = paymentAdapter.getDataList().get(position).getPayment_code();
                }
            }
        });
        //监听反馈信息
        TakeCar_etDepositWithDrawBankName.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                String bankName = TakeCar_etDepositWithDrawBankName.getText().toString().trim();
                if (!StringUtils.isBlank(bankName) && !StringUtils.isBlank(s.toString())){
                    ViewUtil.GetViewShgape(bank_next);
                    bank_next.setClickable(true);
                    bank_next.setBackgroundResource(R.drawable.bg_btn_green_selector);
                    ViewUtil.SetViewShgape(bank_next);
                }else {
                    ViewUtil.GetViewShgape(bank_next);
                    bank_next.setClickable(false);
                    bank_next.setBackgroundResource(R.drawable.bg_btn_gray);
                    ViewUtil.SetViewShgape(bank_next);
                }
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });
        TakeCar_etDepositWithDrawBankNum.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                String bankNo = TakeCar_etDepositWithDrawBankNum.getText().toString().trim();
                if (!StringUtils.isBlank(bankNo) && !StringUtils.isBlank(s.toString())){
                    ViewUtil.GetViewShgape(bank_next);
                    bank_next.setClickable(true);
                    bank_next.setBackgroundResource(R.drawable.bg_btn_green_selector);
                    ViewUtil.SetViewShgape(bank_next);
                }else {
                    ViewUtil.GetViewShgape(bank_next);
                    bank_next.setClickable(false);
                    bank_next.setBackgroundResource(R.drawable.bg_btn_gray);
                    ViewUtil.SetViewShgape(bank_next);
                }
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });
    }

    @Override
    protected void initData() {
        //判断当前验证到哪一步
        currentStep = DataCheckUtil.getCurrentAuthStep(mContext)[0];
        currentStatus = DataCheckUtil.getCurrentAuthStep(mContext)[1];
        Log.e("会员认证",currentStep+String.valueOf(currentStatus));
        showCurrentView();

        paymentAdapter = new PaymentAdapter(this, R.layout.item_payment);
        listPayment.setAdapter(paymentAdapter);

        List<Payment> payments = new Payment().getPaymentListForOnLine(mContext);
        paymentAdapter.getDataList().addAll(payments);
        paymentAdapter.notifyDataSetChanged();

    }

    /**
     * 显示相应界面的视图
     */
    private void showCurrentView(){
            setupTopBarTitle(currentStep);
            setupVerifyContentView(currentStep);
            setupVerifyStepDriver(currentStep);
    }
    @OnClick({R.id.tvDriverInfoTakePhoto, R.id.tvDriverInfoNext, R.id.tvIdInfoTakePhoto,
            R.id.tvIdInfoNext, R.id.tvHalfBodyIdInfoTakePhoto, R.id.tvHalfBodyIdInfoNext,
            R.id.tvDepositConfirmPayment, R.id.tvDepositVerifySubmit,
            R.id.ivVerifyStatus1, R.id.ivVerifyStatus2, R.id.ivVerifyStatus3, R.id.ivVerifyStatus4,
            R.id.ivVerifyStatus5,R.id.ivVerifyStatus6,R.id.bank_next})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tvIdInfoTakePhoto: //拍摄-身份证
                takePhoto();
                break;
            case R.id.tvIdInfoNext: //下一步身份证
                updateImage();
                break;
            case R.id.tvHalfBodyIdInfoTakePhoto: //拍摄-半身照
                takePhoto();
                break;
            case R.id.tvHalfBodyIdInfoNext: //下一步-半身照
                updateImage();
                break;
            case R.id.tvDriverInfoTakePhoto: //拍摄-驾照
                takePhoto();
                break;
            case R.id.tvDriverInfoNext: //下一步-驾照
                updateImage();
                break;
            case R.id.bank_next: //银行验证
                //申请提现
                String bankNo = TakeCar_etDepositWithDrawBankNum.getText().toString().trim();
                String bankName = TakeCar_etAccountWithDrawBankType.getText().toString().trim();
                String userName= TakeCar_etDepositWithDrawBankName.getText().toString().trim();
                String idnumber=TakeCar_etDepositWithDrawIdNumber.getText().toString().trim();
                TakeCar_submitTransaction(bankNo,bankName,userName,idnumber);
                break;
            case R.id.tvDepositConfirmPayment: //押金缴纳未支付-支付按钮
                for (int i = 0; i < paymentAdapter.getDataList().size(); i++) {
                    if(paymentAdapter.getDataList().get(i).isChoose) {
                        paymentCode = paymentAdapter.getDataList().get(i).getPayment_code();
                    }
                }
                //loadGetPaymentOrderParam();
                break;
            case R.id.ivVerifyStatus1: //验证流程第一步-身份证
                currentStep = 1;
                currentStatus = DataCheckUtil.getCurrentStatusOfStep(mContext,currentStep);
                showCurrentView();
                break;
            case R.id.ivVerifyStatus2: //验证流程第二步-半身照
                currentStep = 2;
                currentStatus = DataCheckUtil.getCurrentStatusOfStep(mContext,currentStep);
                showCurrentView();
                break;
            case R.id.ivVerifyStatus3: //验证流程第三步-行驶证
                currentStep = 3;
                currentStatus = DataCheckUtil.getCurrentStatusOfStep(mContext,currentStep);
                showCurrentView();
                break;
            case R.id.ivVerifyStatus4: //验证流程第六步-银行
                currentStep = 4;
                currentStatus = DataCheckUtil.getCurrentStatusOfStep(mContext,currentStep);
                showCurrentView();
                break;
            case R.id.ivVerifyStatus5: //验证流程第四步-押金缴纳
                currentStep = 5;
                currentStatus = DataCheckUtil.getCurrentStatusOfStep(mContext,currentStep);
                showCurrentView();
                break;
            case R.id.ivVerifyStatus6: //验证流程第五步-审核信息
                break;
        }
    }

    /** 设置验证流程主内容*/
    private void setupVerifyContentView(int currentIndex) {

        if (currentStatus == 1){          //已认证
            layoutCheckSuccess.setVisibility(View.VISIBLE);
            layoutPromptStatus.setVisibility(View.GONE);
        }else  if (currentStatus == 2){    //认证中
            layoutPromptStatus.setVisibility(View.VISIBLE);
            layoutCheckSuccess.setVisibility(View.GONE);
        }else {                            //未认证
            layoutCheckSuccess.setVisibility(View.GONE);
            layoutPromptStatus.setVisibility(View.GONE);
            switch (currentIndex){
                case 1:
                    layoutVerifyIdentity.setVisibility(View.VISIBLE);
                    layoutVerifyHalfBodyIdentity.setVisibility(View.GONE);
                    layoutVerifyDriver.setVisibility(View.GONE);
                    layoutBank.setVisibility(View.GONE);
                    layoutDepositPayment.setVisibility(View.GONE);
                    break;
                case 2:
                    layoutVerifyIdentity.setVisibility(View.GONE);
                    layoutVerifyHalfBodyIdentity.setVisibility(View.VISIBLE);
                    layoutVerifyDriver.setVisibility(View.GONE);
                    layoutBank.setVisibility(View.GONE);
                    layoutDepositPayment.setVisibility(View.GONE);
                    break;
                case 3:
                    layoutVerifyIdentity.setVisibility(View.GONE);
                    layoutVerifyHalfBodyIdentity.setVisibility(View.GONE);
                    layoutVerifyDriver.setVisibility(View.VISIBLE);
                    layoutBank.setVisibility(View.GONE);
                    layoutDepositPayment.setVisibility(View.GONE);
                    break;
                case 4:
                    layoutVerifyIdentity.setVisibility(View.GONE);
                    layoutVerifyHalfBodyIdentity.setVisibility(View.GONE);
                    layoutVerifyDriver.setVisibility(View.GONE);
                    layoutBank.setVisibility(View.VISIBLE);
                    layoutDepositPayment.setVisibility(View.GONE);
                    break;
                case 5:
                    layoutVerifyIdentity.setVisibility(View.GONE);
                    layoutVerifyHalfBodyIdentity.setVisibility(View.GONE);
                    layoutVerifyDriver.setVisibility(View.GONE);
                    layoutBank.setVisibility(View.GONE);
                    layoutDepositPayment.setVisibility(View.VISIBLE);
                    //获取保证金详情
                    DataLoadUtil.getDepositDetail(mContext, true, new MemberDepositCallBack() {
                        @Override
                        public void getMemberDeposit(final MemberDeposit memberDeposit) {
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    tvDepositPaymentAmount.setText("押金缴纳："+memberDeposit.required_deposit_amount_format);
                                    tvDepositPaymentTip.setText(memberDeposit.required_deposit_amount_remark);
                                    if ("1".equals(memberDeposit.required_deposit_amount_remark_style)){
                                        tvDepositPaymentTip.setTextColor(mContext.getResources().getColor(R.color.main_red));
                                    }else {
                                        tvDepositPaymentTip.setTextColor(mContext.getResources().getColor(R.color.black));
                                    }
                                }
                            });
                        }
                    });
                    break;
                case 6:
                    layoutPromptStatus.setVisibility(View.VISIBLE);
                    break;
            }
        }
    }

    /** 设置头部标题*/
    private void setupTopBarTitle(int currentIndex) {
        if(currentIndex == 1) { topBar.setText(TopBar.TITLE, getString(R.string.top_bar_identification)); }
        if(currentIndex == 2) { topBar.setText(TopBar.TITLE, getString(R.string.top_bar_identification)); }
        if(currentIndex == 3) { topBar.setText(TopBar.TITLE, getString(R.string.top_bar_driver_information)); }
        if(currentIndex == 4) { topBar.setText(TopBar.TITLE, getString(R.string.top_bar_bank_payment)); }
        if(currentIndex == 5) { topBar.setText(TopBar.TITLE, getString(R.string.top_bar_deposit_payment)); }
        if(currentIndex == 6) { topBar.setText(TopBar.TITLE, getString(R.string.top_bar_verify_message)); }
    }

    /** 设置验证流程中间分割线的显示*/
    private void setupVerifyStepDriver(int currentIndex) {
        tvVerifyDriver1.setBackgroundColor(currentIndex >= 2 ? getResources().getColor(R.color.main_blue) : getResources().getColor(R.color.car_gray));
        tvVerifyDriver2.setBackgroundColor(currentIndex >= 3 ? getResources().getColor(R.color.main_blue) : getResources().getColor(R.color.car_gray));
        tvVerifyDriver3.setBackgroundColor(currentIndex >= 4 ? getResources().getColor(R.color.main_blue) : getResources().getColor(R.color.car_gray));
        tvVerifyDriver4.setBackgroundColor(currentIndex >= 5 ? getResources().getColor(R.color.main_blue) : getResources().getColor(R.color.car_gray));
        tvVerifyDriver5.setBackgroundColor(currentIndex == 6 ? getResources().getColor(R.color.main_blue) : getResources().getColor(R.color.car_gray));


        ivVerifyStatus1.setBackgroundResource(currentIndex >= 1 ? R.drawable.bg_site_count_blue_shape : R.drawable.bg_site_count_gray_shape);
        ivVerifyStatus2.setBackgroundResource(currentIndex >= 2 ? R.drawable.bg_site_count_blue_shape : R.drawable.bg_site_count_gray_shape);
        ivVerifyStatus3.setBackgroundResource(currentIndex >= 3 ? R.drawable.bg_site_count_blue_shape : R.drawable.bg_site_count_gray_shape);
        ivVerifyStatus4.setBackgroundResource(currentIndex >= 4 ? R.drawable.bg_site_count_blue_shape : R.drawable.bg_site_count_gray_shape);
        ivVerifyStatus4.setBackgroundResource(currentIndex >= 5 ? R.drawable.bg_site_count_blue_shape : R.drawable.bg_site_count_gray_shape);
    }

    /** 获取支付保证金订单的支付数据
    void loadGetPaymentOrderParam() {
        new LHttpLib().submitDeposit(mContext, memberId, paymentCode, new BaseLHttpHandler(mContext, true, true) {

            @Override
            public void onSuccess(JSONStatus jsonStatus) {
                super.onSuccess(jsonStatus);
                String payment_order_param = jsonStatus.data.optString("payment_order_param");
                new PayUtil(TakeCarVerifyActivity.this, payment_order_param,paymentCode);
            }
        });
    }*/

    @Override
    public void onBackPressed() {
        super.onBackPressed();
    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(requestCode == 101 && resultCode == TakePhotoActivity.UPLOAD_SUCCESS) {
            if(data != null && data.getExtras() != null) {
                currentImgLocalPath = data.getExtras().getString("PATH");
                switch (currentStep){
                    case 1:
                        MyApplication.getDefaultFinalBitmap(mContext).display(ivIdInfo, currentImgLocalPath);
                        //下一步按钮置为可点击状态
                        tvIdInfoNext.setBackgroundResource(R.drawable.bg_btn_green_shape_selector);
                        tvIdInfoNext.setClickable(true);
                        currentImgUploadType = Constants.IMAGE_TYPE_ID_NUM;
                        break;
                    case 2:
                        MyApplication.getDefaultFinalBitmap(mContext).display(ivHalfBodyIdInfo, currentImgLocalPath);
                        //下一步按钮置为可点击状态
                        tvHalfBodyIdInfoNext.setBackgroundResource(R.drawable.bg_btn_green_shape_selector);
                        tvHalfBodyIdInfoNext.setClickable(true);
                        currentImgUploadType = Constants.IMAGE_TYPE_HAND_ID;
                        break;
                    case 3:
                        MyApplication.getDefaultFinalBitmap(mContext).display(ivDriverInfo, currentImgLocalPath);
                        tvDriverInfoNext.setBackgroundResource(R.drawable.bg_btn_green_shape_selector);
                        currentImgUploadType = Constants.IMAGE_TYPE_DRIVER_ID;
                        break;
                }
            }
        }
        if (requestCode == 100 && resultCode == RESULT_OK){
            TakeCar_etAccountWithDrawBankType.setText(data.getStringExtra("bank_name"));
            BankbankId = data.getStringExtra("bank_id");
        }
    }
    /**
     * 上传相应的图片
     * @param
     */
    private void updateImage() {
        if (StringUtils.isBlank(currentImgLocalPath)){
            ToastUtil.showShort(mContext,"请先选择照片");
            return;
        }
        new LHttpLib().editImage(mContext, memberId, currentImgUploadType, currentImgLocalPath, new BaseLHttpHandler(mContext, true, true) {
            @Override
            public void onSuccess(JSONStatus jsonStatus) {
                super.onSuccess(jsonStatus);
                final Image image = new Image().parse(jsonStatus.data.optJSONObject("image_info"));
                //身份证情况下暂时不做上传，与半身照一并上传
                if (currentImgUploadType.equals(Constants.IMAGE_TYPE_ID_NUM)){
                    identificationUploadPath = image.source;
                    showNextView();
                }else  if (currentImgUploadType.equals(Constants.IMAGE_TYPE_HAND_ID)){
                    submitIdentificationCardInfo(identificationUploadPath,image.source);
                }else {
                    updateImageInfo(currentImgUploadType, image.source);
                }
            }
        });
    }

    /**
     * 更新相应的信息
     * @param value1  身份证
     * @param value2 半身照
     */
    void submitIdentificationCardInfo(String value1, String value2) {
        if (StringUtils.isBlank(value2)){
            ToastUtil.showShort(mContext,"请先选择照片");
            return;
        }
        new LHttpLib().submitIdentificationCardInfo(mContext, memberId, value1, value2, "", new BaseLHttpHandler(mContext, true, true) {
            @Override
            public void onSuccess(JSONStatus jsonStatus) {
                super.onSuccess(jsonStatus);
                //上传图片成功之后 将 currentImgLocalPath支空
                currentImgLocalPath = "";
                showNextView();
            }
        });
    }

    /**
     * 更新相应的信息
     * @param type
     * @param value
     */
    void updateImageInfo(String type, String value) {
        new LHttpLib().editMemberInfo(mContext, memberId, type, value, "", new BaseLHttpHandler(mContext, true, true) {
            @Override
            public void onSuccess(JSONStatus jsonStatus) {
                super.onSuccess(jsonStatus);
                //上传图片成功之后 将 currentImgLocalPath支空
                currentImgLocalPath = "";
                showNextView();
            }
        });
    }

    /**
     * 进入到下一个步骤界面
     */
    private void showNextView(){
        //进入下一个步骤
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                currentStep++;
                currentStatus = DataCheckUtil.getCurrentStatusOfStep(mContext,currentStep);
                showCurrentView();
            }
        });
        //刷新数据
        DataLoadUtil.refreshMemberData(mContext, new MemberCallBack() {
            @Override
            public void getMember(Member member) {
                //监听审核全部通过
                if ("1".equals(member.member_auth_info.member_auth_status)){
                    prompt("恭喜您，审核通过！");
                    finish();
                }
            }
        });
    }
    /**
     * 开启拍照
     */
    private void takePhoto(){
        startActivityForResult(TakePhotoActivity.getTakePhotoStartIntent(mContext,
                DO_BIG_IMAGE, 1, 1, 640, 360), UPLOAD_IMG);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        //反注册EventBus
        EventBus.getDefault().unregister(this);
    }

    /**
     * 接受支付成功的通知信息
     * @param paymentCode
     */
    public void onEventMainThread(String paymentCode){
        switch (paymentCode){
            //支付宝支付成功
            case Constants.PAY_TYPE_ALIPAY:
                showNextView();
                break;
            //微信支付成功
            case Constants.PAY_TYPE_WECHAT:
                showNextView();
                break;
        }
    }
    /**
     * 打开银行选择列表
     */
    @OnClick(R.id.TakeCar_etAccountWithDrawBankType)
    public void onViewClicked() {
        startActivityForResult(new Intent(mContext,BankListActivity.class),100);
    }
    /**
    *提交银行卡信息
     */
    private void TakeCar_submitTransaction(String bankNo,String bankName,String userName,String IdNumber){
        Member member = DataCheckUtil.getMemberObj(mContext);
        new LHttpLib().TakeCar_submitTransaction(mContext,userName,memberId,BankbankId,
                bankName,bankNo,IdNumber,new BaseLHttpHandler(mContext,true,true){
                    @Override
                    public void onSuccess(JSONStatus jsonStatus) {
                        super.onSuccess(jsonStatus);
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                prompt("银行卡认真通过");
                                showNextView();
                            }
                        });
                    }
                });
    }
}
